chore: update protocol - #2421
Conversation
There was a problem hiding this comment.
This file shouldn't be changed.
| let has_allowed_notes = allowlist_entries(NetworkAccountNoteAllowlist::slot_name()) | ||
| .is_some_and(|entries| entries.as_map().values().any(|value| *value != Word::empty())); | ||
| let allows_expiration_tx_script = | ||
| allowlist_entries(NetworkAccountTxScriptAllowlist::slot_name()).is_some_and(|entries| { | ||
| entries | ||
| .as_map() | ||
| .get(&StorageMapKey::new(ExpirationTransactionScript::script_root().as_word())) | ||
| .is_some_and(|value| *value != Word::empty()) | ||
| }); | ||
| let is_network_account = | ||
| account_id.is_public() && has_allowed_notes && allows_expiration_tx_script; |
There was a problem hiding this comment.
I actually wonder if we still need to do this song and dance at all - @SantiagoPittella I believe this was likely a remnant of the ntx builders old sync?
There was a problem hiding this comment.
This check is intended to stop users submitting transactions against network accounts, it's not sync related. It looks like this because AccountId::is_network() went away with AccountStorageMode::Network in #2095, so networkness determination relies on account's storage rather than the ID.
There was a problem hiding this comment.
I guess this means once fee's are turned on our monitor will be dead unless we somehow get it gas?
There was a problem hiding this comment.
Yes, that's the case. It would need funding, either through a faucet or by being provisioned as a pre-funded account at genesis, though either way it would eventually run dry and need topping up.
There was a problem hiding this comment.
Why is this so much more complex?
There was a problem hiding this comment.
The network monitor submits real transactions to prove the chain's write path is alive. Now that notes are priced by the receiving account's fee policy, the wallet's transaction has to read the counter account's fee schedule through an FPI call.
Previously the wallet's transaction touched nothing but itself, so the data store never had to serve foreign account inputs and any reference block would do (genesis included which was what we used). An FPI'd account must be proven against the reference block's account tree, and the counter doesn't exist at genesis, so the transaction now has to anchor on a certain block instead.
(As a note, even on a zero-fee chain the transaction still has to make the FPI call to obtain that zero. pay_fee invokes create_network_note_sponsorships unconditionally before computing anything)
| /// Draw a random [`Word`] from `rng`. | ||
| fn random_word(rng: &mut ChaCha20Rng) -> Word { | ||
| Word::new([ | ||
| Felt::new_unchecked(rng.random()), | ||
| Felt::new_unchecked(rng.random()), | ||
| Felt::new_unchecked(rng.random()), | ||
| Felt::new_unchecked(rng.random()), | ||
| ]) | ||
| } |
There was a problem hiding this comment.
Do we still not have rand implemented for these 🤔
There was a problem hiding this comment.
We have rng implemented for RandomCoin, switched to this type.
Summary
Note
This PR does not work for chains which base fee is not zero (e.g network monitor and benchark binaries are only able to operate with fee-less chains). Full fee implementation is left as a follow-up PR.
Changelog